Dynomotion

Group: DynoMotion Message: 9284 From: moray_cuthill Date: 3/2/2014
Subject: A couple final setup questions


Hi,

 

after a bit too long, I'm getting around to the final setup/tuning of my lathe and have a couple remaining issues/questions.

The first is about tuning the servos. I spent some time earlier tuning the axis, and the best following error I can get is around 45 on the X and 15 on the Z. I'm running velocity mode, and have run the drives built in auto-tune before changing any of the figure, and tried changing P&I. I'll be happy with the Z, however I really want to try and get the X as good as possible (45 works out to around 0.011mm X movement or 0.022mm on the diameter).

I suspect the slant bed design is upsetting the auto-tune, so would I be better to change to torque mode and rely on the KFlop for all the tuning?

I've attached the X and Z step responses, along with the main init thread if anybody want's to suggest any improvements.

 

The other issue is the spindle.

It's run of a VFD, and is setup with a custom output channel (it's at the bottom of the init script) to act like a slow responding servo. It works well, however following error causes issues in certain circumstances. For example, if I run the spindle at full commanded speed (should be 4000rpm, but in reality it tops out at a very steady 3950) the following error continues to increase. This in it's self isn't an issue, however if I then command a slower speed, the spindle doesn't slow down until the following error decreases enough to trigger a change in the servo output.
Is there any easy way to zero the following error on a speed change, or periodically during max speed to avoid a large error accumulating?

I'm not too concerned about this, as I can just rely on not commanding full speed, however it would be nice if there was an easy solution, as I'm wanting to reduce the following error limit so things fault quicker if the spindle stalls for whatever reason.

 

Thanks

Moray

  @@attachment@@
Group: DynoMotion Message: 9285 From: Tom Kerekes Date: 3/2/2014
Subject: Re: A couple final setup questions [3 Attachments]
Hi Moray,

The X axis seems nearly unstable with oscillations around 60Hz.  It's hard to say what the auto tune is doing in the drive.  You might try torque mode.

In either case some D gain (or a lead/lag filter) may help. Larger D gain can make spikes in the output so a 2nd order Low pass filter (1KHz Q1.4) can be used to smooth the output.

If you can get a good Bode Plot that would be helpful.  The trick to getting a good Bode plot is to get the stimulus right - enough stimulus to get good data but not too much to saturate thins.  So if you make a Bode Plot include the Time domain Plot.

There does seem to be some strange non-linear behavior at the beginning of the move (first 50 counts).  Maybe stiction, backlash, or amplifier zero crossing distortion?  But I don't think that is causing the instability. 

Regarding the Spindle:  I can't think of an easy solution.  Since an impossible speed is being commanded the following error will continue to grow forever.  It is like trying to follow a car that can go faster than you can.  It will get a huge (infinite) distance ahead and even when it slows down, stops, or even reverses you will be going full speed to try to approach it.  So in FLOP the Position is far away from the Dest.   I suppose you could change the Encoder Position to be at (or near) the Dest whenever the speed is reduced.  But that might cause a disturbance in the servo output.

If you are ok with it going 3950 when it is commanded 4000, why not just clip the commanded speed to 3940 or something?

Regards
TK


Group: DynoMotion Message: 9286 From: Moray Cuthill Date: 3/2/2014
Subject: Re: A couple final setup questions
Hi Tom,
 
thanks for the reply.
I've just been having a another read of the servo drive manual, and the default analogue input filter is around 125Hz, but the autotune also sets a bandwidth filter, so the combination of those 2 may be where the 60Hz is coming from.
I did notice the peak at the start, however there should be no dead zone or offset set in the drive, so it may just be stiction.
 
I'll try swapping the drive to torque mode tomorrow, as that way I'll have all the control in the one place, and report back.
I've just realised a bode plot is a seperate screen in Kmotion, so I'll try that tomorrow aswell.
 
Regarding the spindle, I'll just make sure I don't command anything above 3900rpm.
 
Thanks
Moray
 


On Sun, Mar 2, 2014 at 10:35 PM, Tom Kerekes <tk@...> wrote:
 

Hi Moray,

The X axis seems nearly unstable with oscillations around 60Hz.  It's hard to say what the auto tune is doing in the drive.  You might try torque mode.

In either case some D gain (or a lead/lag filter) may help. Larger D gain can make spikes in the output so a 2nd order Low pass filter (1KHz Q1.4) can be used to smooth the output.

If you can get a good Bode Plot that would be helpful.  The trick to getting a good Bode plot is to get the stimulus right - enough stimulus to get good data but not too much to saturate thins.  So if you make a Bode Plot include the Time domain Plot.

There does seem to be some strange non-linear behavior at the beginning of the move (first 50 counts).  Maybe stiction, backlash, or amplifier zero crossing distortion?  But I don't think that is causing the instability. 

Regarding the Spindle:  I can't think of an easy solution.  Since an impossible speed is being commanded the following error will continue to grow forever.  It is like trying to follow a car that can go faster than you can.  It will get a huge (infinite) distance ahead and even when it slows down, stops, or even reverses you will be going full speed to try to approach it.  So in FLOP the Position is far away from the Dest.   I suppose you could change the Encoder Position to be at (or near) the Dest whenever the speed is reduced.  But that might cause a disturbance in the servo output.

If you are ok with it going 3950 when it is commanded 4000, why not just clip the commanded speed to 3940 or something?

Regards
TK


Group: DynoMotion Message: 9287 From: Moray Cuthill Date: 3/3/2014
Subject: Re: A couple final setup questions
Hi,
 
I've tried swapping the drive to torque mode, however I'm struggling to even get back to anywhere near the error I was getting in speed mode. I'm now getting an error in exces of 120.
 
I've attached a step response. This was with a P of 2, and D of 0.1.
All increasing the P seemed to do was increase the frequency of the oscillations, but not the length of time they occured (i.e. they always seemd to settle at the same point during the move commane) up until they became physically noticeable around 3.5. Changing the D higher didn't seem to have much noticeabl effect, yet if I added I the oscilations became physically noticeable.
 
I've also attached a couple bode plots. I'm not sure what I really need to do to get a good plot, so I've done one with the default settings, and one with an amplitude of 200 (file with the _1 suffix)
 
The one thing I'm wondering, would the noise filtering on the drive's analogue inputs be part of the problem?
As I mentioned in my last email, the default settings give a filter around 125Hz. Would it be worth disabling/reducing the filter?
 
Thanks
Moray


On Sun, Mar 2, 2014 at 11:27 PM, Moray Cuthill <moray.cuthill@...> wrote:
Hi Tom,
 
thanks for the reply.
I've just been having a another read of the servo drive manual, and the default analogue input filter is around 125Hz, but the autotune also sets a bandwidth filter, so the combination of those 2 may be where the 60Hz is coming from.
I did notice the peak at the start, however there should be no dead zone or offset set in the drive, so it may just be stiction.
 
I'll try swapping the drive to torque mode tomorrow, as that way I'll have all the control in the one place, and report back.
I've just realised a bode plot is a seperate screen in Kmotion, so I'll try that tomorrow aswell.
 
Regarding the spindle, I'll just make sure I don't command anything above 3900rpm.
 
Thanks
Moray
 


On Sun, Mar 2, 2014 at 10:35 PM, Tom Kerekes <tk@...> wrote:
 

Hi Moray,

The X axis seems nearly unstable with oscillations around 60Hz.  It's hard to say what the auto tune is doing in the drive.  You might try torque mode.

In either case some D gain (or a lead/lag filter) may help. Larger D gain can make spikes in the output so a 2nd order Low pass filter (1KHz Q1.4) can be used to smooth the output.

If you can get a good Bode Plot that would be helpful.  The trick to getting a good Bode plot is to get the stimulus right - enough stimulus to get good data but not too much to saturate thins.  So if you make a Bode Plot include the Time domain Plot.

There does seem to be some strange non-linear behavior at the beginning of the move (first 50 counts).  Maybe stiction, backlash, or amplifier zero crossing distortion?  But I don't think that is causing the instability. 

Regarding the Spindle:  I can't think of an easy solution.  Since an impossible speed is being commanded the following error will continue to grow forever.  It is like trying to follow a car that can go faster than you can.  It will get a huge (infinite) distance ahead and even when it slows down, stops, or even reverses you will be going full speed to try to approach it.  So in FLOP the Position is far away from the Dest.   I suppose you could change the Encoder Position to be at (or near) the Dest whenever the speed is reduced.  But that might cause a disturbance in the servo output.

If you are ok with it going 3950 when it is commanded 4000, why not just clip the commanded speed to 3940 or something?

Regards
TK


Group: DynoMotion Message: 9290 From: Tom Kerekes Date: 3/3/2014
Subject: Re: A couple final setup questions [3 Attachments]
Hi Moray,

Yes you should disable the 125Hz filter the current control needs to be much faster than that.  Think of a person with slow response (drunk) weaving down the road.

A Torque mode amplifier will be inherently unstable with just P gain (very unlike a Velocity Amplifier).   This would be like finally taking your foot off the gas when actually reaching the stop sign.  You would be at your maximum velocity at the point you want to stop.  The only way this works at all is to limit the use of a tiny amount of gas.   D gain adds damping.  Which is like dragging the parking brake harder the faster the car is traveling which results in a form of speed control.  This results the car to seek a speed where the drag equals the applied gas.  Since the applied gas reduces as we approach the target, the speed reduces to zero as we approach the target.

Too much D Gain will also cause the system to go unstable.  This is like making a huge of a change in the parking brake based, slightly late, on a small detected change in velocity.

D Gains usually need to be a big number to be effective.  Such as 10~200X the P gain value.  Try again with less P and more D.  Also with the 2nd order low pass filter.

The Bode plots you made are not useful.  The system must be more stable and higher performance to get better response to stimulus.  It is sort of a catch 22.  You need to have a good system to make a good Bode plot to help make a good system :}

Saving the data is great so that we can plot it how we wish, but it doesn't include any of your settings.  So always include a screen shot of the Step Response and Filters screen as well.

HTH
Regards
TK

Group: DynoMotion Message: 9295 From: Moray Cuthill Date: 3/4/2014
Subject: Re: A couple final setup questions
Hi Tom,
 
thanks for the suggestions.
I spend a bit time earlier trying various options, and the first was to reduce the input filtering on the drive as much as possible. However, even at it's minimum setting, it still applies a ~630Hz filter. That's assuming the calculation in the manual gives the result in Hz-
 

Analog1_Filter

Used to smooth the input analog signals

F (Filter Frequency) = 4000/ (2π* Analog1_Filter)

Τ (Time Constant) = Analog1_Filter/4000 (S)

5

1~127

 
Anyway, even after doing that, I just couldn't seem to find any magic combination to improve things in torque mode. Even trying things to extreme limits, the following error remained far too high, with no stability. The attached stepresponse3_1(highDfilter).jpg shows what i was getting. Changing D only seemed to alter the amount of noise on the output, with P again only increasing the frequency of the oscillations, not the length of time they occurred for. That was with your suggested 2nd order low pass filter applied (1khz 1.4Q)
 
So in desperation I swapped the drive back to velocity mode, and things are very much improved, as you'll see from the stepresponse3_3(velocity_withfilter).jpg. There is still noise on the output, however the followign error is the best I've acheived to date.
Have you any suggestions to improve this further, or do you think this will be the best I'm likely to manage?
 
Thanks
Moray


On Mon, Mar 3, 2014 at 6:11 PM, Tom Kerekes <tk@...> wrote:
 

Hi Moray,

Yes you should disable the 125Hz filter the current control needs to be much faster than that.  Think of a person with slow response (drunk) weaving down the road.

A Torque mode amplifier will be inherently unstable with just P gain (very unlike a Velocity Amplifier).   This would be like finally taking your foot off the gas when actually reaching the stop sign.  You would be at your maximum velocity at the point you want to stop.  The only way this works at all is to limit the use of a tiny amount of gas.   D gain adds damping.  Which is like dragging the parking brake harder the faster the car is traveling which results in a form of speed control.  This results the car to seek a speed where the drag equals the applied gas.  Since the applied gas reduces as we approach the target, the speed reduces to zero as we approach the target.

Too much D Gain will also cause the system to go unstable.  This is like making a huge of a change in the parking brake based, slightly late, on a small detected change in velocity.

D Gains usually need to be a big number to be effective.  Such as 10~200X the P gain value.  Try again with less P and more D.  Also with the 2nd order low pass filter.

The Bode plots you made are not useful.  The system must be more stable and higher performance to get better response to stimulus.  It is sort of a catch 22.  You need to have a good system to make a good Bode plot to help make a good system :}

Saving the data is great so that we can plot it how we wish, but it doesn't include any of your settings.  So always include a screen shot of the Step Response and Filters screen as well.

HTH
Regards
TK

Group: DynoMotion Message: 9319 From: Tom Kerekes Date: 3/8/2014
Subject: Re: A couple final setup questions [3 Attachments]
Hi Moray,

(Sorry I think I missed responding to this)

No ideas why torque mode responded poorly, but I think the velocity servo response looks very good. 

I do have comments regarding the motion profile.  You have very high Velocity (400,000) and Acceleration (2e6) settings, but your Jerk is very low (400,000).  With this low value of Jerk it would take 5 seconds to apply the full acceleration.  Usually it is best to apply full acceleration in a small faction of a second.   So for your relatively small move of 5000 counts the motion is totally limited by the Jerk (Velocity and Acceleration settings having no effect).  And the speed is only 14,000 counts/sec.  The Output is only about 3% of maximum Output.

Regards
TK




Group: DynoMotion Message: 9320 From: Moray Cuthill Date: 3/8/2014
Subject: Re: A couple final setup questions
Hi Tom,
 
that would explain why the test move was always pretty slow. I never realised jerk affected acceleration to that extent.
 
I've increased Jerk to 4,000,000, and things seem to be moving quicker, and I had another go at tuning the servo.
I managed to get things very stable with less than 16 error during small and large moves with 3.5P 0.015I and 10D, which mostly seemed helped by increasing the integrator max limit to the full 2048 limit.
However when I went to try homing the machine, the servo became audibly loud while backing of the home switch, and when I went back and tried the step response, the instability was blatantly obvious, so I reduced the PID settings to get stability back.
 
I'm guessing there's maybe a tight spot or two on the axis, and I just so happened to get the good tune on a loose/smoother area. I'm happy with the reduced settings for now, and I'll have another go once the lathe has been used for a few hours, and the autolube has had a chance to get plenty fresh oil circulated (the lathe hadn't been used for at least a couple years before I bought it).
I've also realised I can switch the servos between torque and speed mode easily, so I may have another attempt at setting up torque mode aswell.
 
The Z-axis seemed to tune up far easier, although when I tried applying the low pass filter, it made things noticeably worse.
 
Thanks for the help.
I just need to tidy up my init thread, and merge the modbus one into it, and I should be all set for making parts!
 
Thanks
Moray


On Sat, Mar 8, 2014 at 5:58 PM, Tom Kerekes <tk@...> wrote:
 

Hi Moray,

(Sorry I think I missed responding to this)

No ideas why torque mode responded poorly, but I think the velocity servo response looks very good. 

I do have comments regarding the motion profile.  You have very high Velocity (400,000) and Acceleration (2e6) settings, but your Jerk is very low (400,000).  With this low value of Jerk it would take 5 seconds to apply the full acceleration.  Usually it is best to apply full acceleration in a small faction of a second.   So for your relatively small move of 5000 counts the motion is totally limited by the Jerk (Velocity and Acceleration settings having no effect).  And the speed is only 14,000 counts/sec.  The Output is only about 3% of maximum Output.

Regards
TK